﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZerAx.Tweaks
{
    public static class CompareExtensions
    {
        /// <summary>
        /// x >= lower && x < upper
        /// </summary>
        /// <param name="x">The number you want to compare</param>
        /// <param name="lower">minimal side</param>
        /// <param name="upper">maximal side</param>
        /// <returns></returns>
        public static bool IsBetween(this int x, int lower, int upper)
        {
            return x >= lower && x < upper;
        }

        public static bool IsInRect(this (int x, int y) point, int xMin, int xMax, int yMin, int yMax)
        {
            return point.x.IsBetween(xMin, xMax) && point.y.IsBetween(yMin, yMin);
        }

        public static bool IsInCube(this (int x, int y, int z) point, int xMin, int xMax, int yMin, int yMax, int zMin, int zMax)
        {
            return point.x.IsBetween(xMin, xMax) && point.y.IsBetween(yMin, yMax) && point.z.IsBetween(zMin, zMax);
        }

    }
}
